<?php
if (!defined('IN_XLP')) {
    exit('Access Denied');
}
$Document = array(
    'pageid' => 'forum-index', //页面标示
    'pagename' => '主题帖子列表', //当前页面名称
    'mycss' => array(), //加载的css样式表
    'myjs' => array(), //加载的js脚本
	'footerjs'=>array('content/jquery.smoothConfirm','content/calendar'),
    'head' => true, //加载头部文件
);

include getTpl('header', 'public');
?>
<!--顶部导航 开始-->
<?php include getTpl('top', 'public');?>
<!--顶部导航 结束-->
<!--左侧菜单 开始-->
<?php include getTpl('nav', 'public');?>
<!--左侧菜单 结束-->
<!--主体 开始-->
<!-- content -->

<section id="content"> 
  <!-- main padder -->
  <section class="main padder">
    <div class="clearfix">
      <h4><i class="fa fa-table"></i><?php echo trim($Document['pagename'],'_');?></h4>
    </div>
    <div class="row"> 
      
      <!-- table 11 -->
      <div class="col-lg-12">
        <section class="panel">
          <!---->
          <div class="panel-body">
            <div class="row text-small">
              <div class="col-sm-6">
              <div data-resize="auto" class="select btn-group"> 
                  <button class="btn btn-white dropdown-toggle" data-toggle="dropdown" type="button"><span class="dropdown-label">帖子类型</span> <span class="caret"></span></button> 
                <ul class="dropdown-menu">
                 <li data-value=""><a href="<?php echo U('forum/index',array('all'=>1));?>">全部</a></li>
                  <li data-value=""><a href="<?php echo U('forum/index',array('hot'=>1));?>">精品</a></li>
                  <li data-value=""><a href="<?php echo U('forum/index',array('top'=>1));?>">置顶</a></li>
                  <!-- <li data-value=""><a href="<?php echo U('forum/index',array('report'=>1));?>">违规</a></li> -->
                  <!-- <li data-value=""><a href="<?php echo U('forum/index',array('status'=>1));?>">回收站</a></li> -->
                </ul>
                </div>
                <!-- <a href="<?php echo U('forum/tags_list');?>" class="btn btn-default">论坛标签</a> -->
              </div>
              <div class="col-sm-6">
                <form action="<?php echo U(ACTION_NAME.'/index');?>" method="get" name="form1" target="_self">
                <div class="col-sm-7 m-b-mini">
                    <div class="form-group">
                        <div class="col-sm-6">
                          <input type="text" readonly="" onclick="new Calendar().show(this);" value="" class="form-control" placeholder="开始时间" name="stime">
                        </div>
                        <div class="col-sm-6">
                          <input type="text" readonly="" onclick="new Calendar().show(this);" value="" class="form-control" placeholder="结束时间" name="etime">
                        </div>
                    </div>
		     	 </div>
                  <div class="col-sm-5 input-group">
                    <input type="text" name="q" class="input-sm form-control" placeholder="请输入搜索关键字..." />
                    <input name="g" type="hidden" value="<?php echo GROUP_NAME;?>" />
                    <input name="c" type="hidden" value="<?php echo ACTION_NAME;?>" />
                    <input name="m" type="hidden" value="<?php echo MODEL_NAME;?>" />
                    <span class="input-group-btn">
                    <button class="btn btn-sm btn-white" type="submit">搜索</button>
                    </span> </div>
                </form>
              </div>
            </div>
          </div>
          <!---->
          <div class="table-responsive">
            <table class="table table-striped b-t text-small">
              <thead>
                <tr>
                  <th align="center">ID</th>
                  <!-- <th align="center">小区</th> -->
                  <th align="center">楼主</th>
                  <th align="center">标题</th>
                  <th align="center">点击数</th>
                  <!-- <th align="center">赞</th> -->
                  <th align="center">回复</th>
                  <!-- <th align="center">照片数</th> -->
                  <th align="center">精品</th>
                  <th align="center">置顶</th>
                  <!-- <th align="center">被举报</th> -->
                  <th align="center">状态</th>
                  <th align="center">发帖时间</th>
                  <th align="center" width="100">操作</th>
                </tr>
              </thead>
              <tbody>
                <?php
                    if ($rs){
                       foreach($rs as $val){
                 ?>
                <tr id="list_detail_<?php echo $val['fid'];?>">
                  <td><?php echo $val['fid'];?></td>
                  <!-- <td><a href="<?php echo U('forum/index',array('village_id'=>$val['village_id']));?>"><?php echo $val['village_name'];?></a></td> -->
                  <td><a href="<?php echo U('forum/index',array('uid'=>$val['uid']));?>"><?php echo $val['user_name'];?></a></td>
                  <td><a href="<?php echo U('forum/detail',array('fid'=>$val['fid']));?>" rel="pop"><?php echo $val['title'];?></a></td>
                  <td><?php echo $val['hits'];?></td>
                  <!-- <td><?php echo $val['love_counts'];?></td> -->
                  <td><?php echo $val['reply_counts'];?></td>
                  <!-- <td><?php echo $val['photo_counts'];?></td> -->
                  <td id="set_hot_id_<?php echo $val['fid'];?>"><?php echo $info[$val['is_hot']];?></td>
                  <td id="set_top_id_<?php echo $val['fid'];?>"><?php echo $info[$val['is_top']];?></td>
                  <!-- <td><?php echo $info[$val['is_report']];?></td> -->
                  <td><?php echo $status[$val['status']];?></td>
                  <td><?php echo outTime($val['infotime']);?></td>
                  <td><div class="btn-group">
                      <button class="btn btn-white btn-xs dropdown-toggle" data-toggle="dropdown">操作<span class="caret"></span></button>
                      <ul class="dropdown-menu">
                      	<?php if(!$recycle){?>
                        <li><a href="javascript:;" rel="<?php echo $val['fid'];?>" class="set-hot">精品</a></li>
                        <li><a href="javascript:;" rel="<?php echo $val['fid'];?>" class="set-top">置顶</a></li>
                        <li class="divider"></li>
                        <li><a rel="pop" href="<?php echo U('forum/edit',array('fid'=>$val['fid']));?>">编辑帖子</a></li>
                        <!-- <li><a target="_blank" href="<?php echo U('weixin/forum/detail',array('vid'=>$val['village_id'],'type'=>1,'fid'=>$val['fid']));?>">回复本帖</a></li> -->
                        <?php }?>
                        <!-- <li><a target="_blank" href="<?php echo U('weixin/forum/index',array('vid'=>$val['village_id']));?>">社区论坛</a></li> -->
                        <li><a rel="pop" href="<?php echo U('member/detail',array('uid'=>$val['uid'],'all'=>1));?>">楼主信息</a></li>
                        <li class="divider"></li>
                        <?php if($recycle){?>
                        <li><a href="javascript:;" rel="<?php echo $val['fid'];?>" class="set-ok">恢复</a></li>
                        <li><a href="javascript:;" rel="<?php echo $val['fid'];?>" class="set-clear">彻底删除</a></li>
                        <?php }else{?>
                        <li><a href="javascript:;" rel="<?php echo $val['fid'];?>" class="delete">删除</a></li>
                        <?php }?>
                      </ul>
                    </div></td>
                </tr>
                <?php
                    }
                 }else{
              ?>
                <tr>
                  <td colspan="20" align="center">暂无数据</td>
                </tr>
                <?php
                  }
                ?>
              </tbody>
            </table>
          </div>
          <footer class="panel-footer">
            <div class="row">
              <div class="col-sm-12 text-right text-center-sm"> <?php echo page($total,$p,'',20,'p');?> </div>
            </div>
          </footer>
        </section>
      </div>
      <!--/ table 11 -->
    </div>
  </section>
  <!--/ main padder --> 
</section>
<!--/ content --> 
<!--主体 结束--> 
<script>
$(function(){
	$('.set-hot').click(function(){
		var id=$(this).attr('rel');
	  $(this).smoothConfirm("请选择操作类型", {
		  okVal:'设置',
		  cancelVal:'取消',
		  ok: function() {
			  Msg.loading();
			  $.post('<?php echo U('forum/setting');?>',{"id":id,"is_hot":1},function(result){
				  Msg.hide();
				  $("#set_hot_id_"+id).html('<?php echo $info[1];?>');
			  },'json');
		  },
		  cancel: function() {
			  $.post('<?php echo U('forum/setting');?>',{"id":id,"is_hot":2},function(result){
				  $("#set_hot_id_"+id).html('<?php echo $info[0];?>');
			  },'json');
		  }
	  });
	  $("body").click();//取消弹出层对对话框的遮蔽
	  return false;
	})
	$('.set-top').click(function(){
	var id=$(this).attr('rel');
	  $(this).smoothConfirm("请选择操作类型", {
		  okVal:'设置',
		  cancelVal:'取消',
		  ok: function() {
			  Msg.loading();
			  $.post('<?php echo U('forum/setting');?>',{"id":id,"is_top":1},function(result){
				  Msg.hide();
				  $("#set_top_id_"+id).html('<?php echo $info[1];?>');
			  },'json');
		  },
		  cancel: function() {
			  $.post('<?php echo U('forum/setting');?>',{"id":id,"is_top":2},function(result){
				  $("#set_top_id_"+id).html('<?php echo $info[0];?>');
			  },'json');
		  }
	  });
	  $("body").click();//取消弹出层对对话框的遮蔽
	  return false;
	})
	$('.delete').click(function(){
		var id=$(this).attr('rel');
	  $(this).smoothConfirm("确认删除该主题吗？", {
		  ok: function() {
			  $.post('<?php echo U('forum/delete');?>',{"id":id},function(result){
				  $("#list_detail_"+id).fadeOut();
			  },'json');
		  },
		  cancel: function() {
			  return false;
		  }
	  });
	  $("body").click();//取消弹出层对对话框的遮蔽
	  return false;
	})
	$('.set-ok').click(function(){
		var id=$(this).attr('rel');
	  $(this).smoothConfirm("确认恢复该主题吗？", {
		  ok: function() {
			  $.post('<?php echo U('forum/setting');?>',{"id":id,"is_ok":1},function(result){
				  $("#list_detail_"+id).fadeOut();
			  },'json');
		  },
		  cancel: function() {
			  return false;
		  }
	  });
	  $("body").click();//取消弹出层对对话框的遮蔽
	  return false;
	})
	$('.set-clear').click(function(){
		var id=$(this).attr('rel');
	  $(this).smoothConfirm("<span class=\"red\">确认移除该主题吗？</span>", {
		  ok: function() {
			  $.post('<?php echo U('forum/clear');?>',{"id":id},function(result){
				  $("#list_detail_"+id).fadeOut();
			  },'json');
		  },
		  cancel: function() {
			  return false;
		  }
	  });
	  $("body").click();//取消弹出层对对话框的遮蔽
	  return false;
	})
})
</script>
<?php
include getTpl('footer', 'public');
?>
